<?php

	$TEMP->set_file(array('handle' => DIR_IFRAME_VIEW . 'viewProfile.html'));
	
	$accountUserID 	= $_GET['id'];
	
	if ( !empty($accountUserID) ) {
		$personalInfo = $PI->getPersonalInformation($accountUserID);
		
		//$imagePreview = ( file_exists(DIR_UPLOADS . $personalInfo['picture']) && !empty($personalInfo['picture'])) ? $personalInfo['picture'] : 'person_blank.jpg';
		
		$accountDesc = $DSC->getDepartment($personalInfo['dept_idFK']);

		switch($personalInfo['account_type']) {
			case 'A': $accountType = "Administrator's Account"; break;
			case 'R': $accountType = "Registrar's Account"; break;
			case 'D': $accountType = "Dean's Account"; break;
			case 'P': $accountType = "Faculty's Account"; break;
			case 'S': $accountType = "Student's Account"; break;
		}
		
		$picture = ( file_exists(DIR_UPLOAD . $personalInfo['picture']) && !empty($personalInfo['picture'])) ? $personalInfo['picture'] : 'person_blank.jpg';
		
		$TEMP->set_var(array('account_no' 	=> $personalInfo['account_no'],
							 'account_type' => $accountType,
							 'name' 		=> $personalInfo['first_name'] . ' ' . $personalInfo['middle_name'] . ' ' . $personalInfo['last_name'],
							 'bdate' 		=> FdY($personalInfo['birthdate']),
							 'gender' 		=> firstUpperCase($personalInfo['gender']),
							 'email' 		=> $personalInfo['email'],
							 'contact_no' 	=> $personalInfo['contact_no'],
							 'address' 		=> $personalInfo['address'],
							 'guardian' 	=> $personalInfo['guardian'],
							 'username' 	=> $personalInfo['log_user'],
							 'department'	=> $accountDesc['dept_desc'],
							 'picture_prof'	=> '<img src="' . DIR_UPLOAD . $picture . '" width="100" height="100" border="0" class="picture-border-view"/>',
							 ));
	}
?>